<template>
    <div>
        <h2>会员等级列表</h2>
        <input type="button" value="会员等级添加" class="btn btn-info" @click="Add">
        <div>
            <span>会员等级名称:</span>
            <input type="text" v-model="model.LevelName">
            <input type="button" value="查询" class="btn btn-success" @click="GetLevelList">
        </div>
        <table class="table table-bordered">
            <tbody>

                <tr class="bg-primary">
                    <td>会员等级名称</td>
                    <td>操作</td>
                </tr>
                <tr v-for=" item in list" :key="item.Id">
                    <td>{{ item.LevelName }}</td>
                    <td>操作</td>
                </tr>
            </tbody>
        </table>
    </div>
</template>

<script setup lang="ts">


//跳转到添加
const Add = () => {
    router.push('/memberLevelAdd');
}

import { ref, reactive, onMounted, renderSlot } from 'vue';
import { useRoute, useRouter } from 'vue-router';
import axios from 'axios';
const route = useRoute();
const router = useRouter();

//查询
let model = reactive({
    LevelName: '',

})

//数据
let list: any = ref([]);


//显示
onMounted(() => {
    GetLevelList();

})


//发送后台
const GetLevelList = () => {

    axios({
        url: 'https://localhost:7035/api/ZMemberLevel/ZMemberLevelList',
        method: 'get',
        params: model,
    })

        .then((res) => {
            console.log(res);
            list.value = res.data;
        })


        .catch((ree) => {
            console.log(ree);
        })







}
</script>

<style scoped></style>